#!/bin/sh

#作者：范洪星
#描述：导出autolog日志，用于以后测试数据清洗，建模等用途
#时间：2015年01月05日 星期一 上午

begin=`date -d "20140601" "+%Y%m%d"`
end=`date -d "20150103" "+%Y%m%d"`

current=$begin


while [ $current -lt $end ]
do
	`hadoop jar /opt/sohuhadoop/hadoop/contrib/streaming/hadoop-streaming-0.20.2-cdh3u1.jar -input /user/autolog/pvlog/$current -output /user/autolog/tmp/fan/$current -mapper 'python Demo1Mapper.py' -jobconf mapred.reduce.tasks=10 -file Demo1Mapper.py`
	#echo $current
	`hadoop dfs -text /user/autolog/tmp/fan/$current/pa* > /opt/fanhongxing/autolog_${current}.txt`
	`gzip /opt/fanhongxing/autolog_${current}.txt`
	current=`date -d "$current  1 days" "+%Y%m%d"`
done
